<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/24/024
 * Time: 11:43
 */

namespace App\Validator;


class Menu extends BaseValidate
{
    protected $rules = [
        'id'=>'required|integer',
        'title'=>'required|string|max:100',
        'parent_id'=>'required|integer|min:0',
        'status'=>'required|integer|in:-1,0,1',
        'url'=>'max:100',
        'sort_no'=>'required|integer|min:0',
        'is_menu'=>'required|in:0,1',
        'is_checked'=>'required|in:0,1',
        'method'=>'required|in:0,1,2',

    ];
    protected $messages = [
        'id.required'=>'id参数缺失',
        'id.integer'=>'id参数格式错误',
        'title.required'=>'名称参数缺失',
        'title.string'=>'名称参数格式错误',
        'title.max'=>'名称参数最长100位',
        'parent_id.required'=>'父级id参数缺失',
        'parent_id.integer'=>'父级id参数格式错误',
        'parent_id.min'=>'父级id参数最小为0',
        'status.required'=>'状态参数缺失',
        'status.integer'=>'状态参数格式错误',
        'status.in'=>'状态参数值错误',
        'url.max'=>'url长度最长100位',
        'sort_no.required'=>'排序参数缺失',
        'sort_no.integer'=>'排序参数格式错误',
        'sort_no.min'=>'排序参数最小为0',
        'is_menu.required'=>'菜单参数缺失',
        'is_menu.in'=>'菜单参数不合法',
        'is_checked.required'=>'权限参数缺失',
        'is_checked.in'=>'权限参数不合法',
        'method.required'=>'请求方式参数缺失',
        'method.in'=>'请求方式参数不合法',

    ];
    protected $scenes = [
        'add'=>['title','parent_id','status','url','sort_no','is_menu','is_checked','method'],
        'edit'=>['id','title','parent_id','status','url','sort_no','is_menu','is_checked','method'],
        'sortNo'=>['id','sort_no'],
        'menu'=>['id','is_menu'],
        'check'=>['id','is_checked'],
    ];

}